# -*- coding: utf-8 -*-
# @Time: 2021/8/19 10:40
# @File: arg-1.py
# @DESC: https://leetcode-cn.com/problems/two-sum/
# 两数之后

def func(nums, target):
    print()
    for index0, i in enumerate(nums):
        for index1, j in enumerate(nums):
            if target == i + j and index0 != index1:
                return [index0, index1]
    return []


def func1(nums, target):
    print()
    lent = len(nums)
    for i in range(lent):
        for j in range(i + 1, lent):
            if nums[i] + nums[j] == target:
                return [i, j]
    return []


def func2(nums, target):
    print()
    map = {}
    for index,i in enumerate(nums):
        if target - i in map:
            return [map[target-i],index]
        map[i] = index
    return []

data = [3, 3]
target = 6

r = func2(data, target)
print(r)
